package com.rest.demo.Controller;

import com.rest.demo.Service.Dysmtl2;
import com.rest.demo.util.excel.ExportExcel;
import com.rest.demo.util.excel.ImportMysql;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@Data
@RestController
@RequestMapping("/Corpor")//整个路由路径
public class GetCorporationInfo {
    Dysmtl2 GetCorporationInfo = new Dysmtl2();
    @Value("${APiUrl.DysmtGsUrl}")
    String DysmtGsUrl;//请求企业信息的api主地址

    @Value("${APiUrl.DysmtGsToken}")
    String DysmtGsToken;//企业信息请求令牌


    @Value("${APiUrl.DysmtGsGetCodeUrl}")
    String DysmtGsGetCodeUrl;//请求Code地址

    @Value("${APiUrl.DysmtQyycmlUrl}")
    String DysmtQyycmlUrl;//企业异常目录请求地址
    @Value("${APiUrl.DysmtQyycmlToken}")
    String DysmtQyycmlToken;//企业异常目录请求令牌



//企业基本信息查询
    @RequestMapping("/GetCPInfo")
    public String GetInfo(String name,String dm,String gszchm) throws IOException {

        String AppCode =GetCorporationInfo.GetCode2(DysmtGsGetCodeUrl);
        String result =GetCorporationInfo.GetCode(name,gszchm,AppCode,dm,DysmtGsToken,DysmtGsUrl);
//        String result =GetCorporationInfo.GetCode("德阳市民通数字科技有限公司",AppCode,"91510600MA66G9U571",DysmtGsToken,DysmtGsUrl);
//        GetCorporationInfo.GetCode("德阳东方电机厂有限公司",AppCode,"91510600205102289E",DysmtGsToken,DysmtGsUrl);
        System.out.println(result);
        return result ;
    }



    //企业异常目录信息查询
    @RequestMapping("/GetYcmlInfo")
    public String GetYcmlInfo(String name,String Dm) throws IOException {
        String AppCode =GetCorporationInfo.GetCode2(DysmtGsGetCodeUrl);
//        System.out.println(DysmtQyycmlToken);
        String result =GetCorporationInfo.GetYcmlInfo(name,Dm,AppCode,DysmtQyycmlToken,DysmtQyycmlUrl);

        return result ;
    }




    @RequestMapping("/GetCPInfo2")
    public String GetInfo2()   {
       return GetCorporationInfo.GetCode2(DysmtGsGetCodeUrl);

    }

}
